<?php
$current_date	= date("Y-m-d", time());
	
$result = $model->getPelangganList();

$id_pelanggan = '<select name="pelanggan_id" id="pelanggan_id">';
if( count($result) > 0 ){
	foreach($result as $x)
		$id_pelanggan .= '<option value="'.$x['Id'].'">'.$x['Id'].'</option>';
}
$id_pelanggan .= '</select>';

$result = $model->getPOList();

$id_po = '<select name="po_id" id="po_id">';
if( count($result) > 0 ){
	foreach($result as $x)
		$id_po .= '<option value="'.$x['Id'].'">'.$x['Id'].'</option>';
}
$id_po .= '</select>';

?>
<script type="text/javascript">
$(document).ready(function(){	
	// functions
	<?php require('library/js/validator/functions.js');?>
	
	// pengiriman
	<?php require('library/js/form/input.pengiriman.js');?>
	
	// VALIDATOR	
	// pengiriman dinamis	
	<?php require('library/js/validator/form.input.pengiriman.js');?>	
	
	// validation config
	<?php require('library/js/validator/config.pengiriman.js');?>	
	
	$('input#tgl_pengiriman').datePicker();
});
</script>
<textarea style="display:none" id="template_pengiriman">
	<li><span>
			<label>{0}</label>
			<input type="text" id="jml_kotak-{0}" name="jml_kotak-{0}" class="jumlah_kotak"/>
			<input type="text" id="jml_kecambah-{0}" name="jml_kecambah-{0}" class="jumlah_kecambah"/>
			<input type="text" id="keterangan-{0}" name="keterangan-{0}" class="keterangan"/>
			<input type="button" class="hapus_pengiriman button"  name="hapus_pengiriman" value="Hapus"/>
		</span>
	</li> 
</textarea>
<div class="title">Pengiriman</div>
<form name="frm_<?=$subbagian;?>" id="frm_<?=$subbagian;?>" method="post" action="index.php?bagian=<?=$bagian;?>&subbagian=<?=$subbagian;?>&action=confirm">
    <ul>
		<li class="header"><span>Administrasi</span></li>
		<li><span>
            <label>Tanggal Pengiriman:</label>
            <input type="text" id="tgl_pengiriman" name="tgl_pengiriman" value="<?=$current_date;?>" readonly="readonly" class="disabled"/>
        </span></li>
		<li><span>
            <label>ID PO:</label>
            <?=$id_po;?>
        </span></li>
		<li><span>
            <label>Nomor DO:</label>
            <input type="text" id="no_do" name="no_do" value=""/>
        </span></li>
		<li><span>
            <label>ID Pelanggan:</label>
            <?=$id_pelanggan;?>
        </span></li>		
		<li><span>
            <label>Tujuan:</label>
            <input type="text" id="tujuan" name="tujuan" value=""/>
        </span></li>
	</ul>
	<ul>
		<li class="header"><span>Order</span></li>
		<li class="desc">
			<span class="jumlah_kotak">Jml Kotak</span>
			<span class="jumlah_kecambah">Jml Kecambah</span>
			<span class="keterangan">Keterangan</span>
		</li>
		<li class="button">
	      <input type="button" name="tambah_pengiriman" id="tambah_pengiriman" value="Tambah Baris"/>
	    </li>		
	</ul>
	<ul>
		<li class="header"><span>Simpan</span></li>
		<li class="button"><span>
			<input type="submit" name="submit" id="submit" value="Simpan Data" class="simpan"/>
		</span></li>
	</ul>
</form>